package Server.Jsmj.RGCP;

import java.util.Random;
import Server.Model.Base.IServerUserItem;

public class Constants {

	static final int INIT_TOTAL = 0;
	static final int INIT_FIRST_ROUND = 1;
	static final int INIT_NEWROUND = 2;

	public static int MAX_CARD_NUM_144 = 144; // �ܼ�144����

	public static int HAND_MJ_MAX = 23;
	public static int MAX_BLOCK_NUM = 7;

	public static int GAME_END_NORMAL = 0;
	public static int GAME_END_PASS = 1;
	public static int GAME_END_ESCAPE = 2;
	public static int GAME_END_MAXROUND = 3;
	public static int GAME_END_DISMISS = 4;

	public static int GANG_BUPAI = 0xFE; // ���Ʋ���
	public static int RESERVED_PAI = 0xFE; // ���Ʋ���

	public static int FALSE = 0;
	public static int TRUE = 1;

	public static int INVALID_CARD =  0xFF; // ��Ч����
	public static int INVALID_SEAT_VALUE =  0xFF;
	public static int INVALID_CHAIR =  0xFF;

	public static int GS_FREE = 0; // ����״̬
	public static int GS_LAZHUANGING = 50;// ��ׯ״̬
	public static int GS_PLAYING = 100; // ��Ϸ״̬

	// �����궨��
	// ����ԭ��
	public static int GER_NORMAL = 0x00; // �������
	public static int GER_DISMISS = 0x01; // ��Ϸ��ɢ
	public static int GER_USER_LEFT = 0x02; // �û��뿪

	// �����붨��
	public static int SUB_S_GAME_START = 100; // ��Ϸ��ʼ
	public static int SUB_S_ADD_GOLD = 101; // ��ע���
	public static int SUB_S_GIVE_UP = 102; // ������ע
	public static int SUB_S_SEND_CARD = 103; // ������Ϣ
	public static int SUB_S_GAME_END = 104; // ��Ϸ����
	public static int SUB_S_OVER = 107; // add

	public static int SUB_GF_SCENE = 111;
	public static int SUB_GF_SIT = 112;
	public static int SUB_GF_STANDUP = 113;
	//////////////////////////////////////////////////////////////////////////
	// ��Ϣ�ṹ��
	// �û�״̬����
	public static int US_NULL = 0x00; // û��״̬
	public static int US_READY = 0x01; // ͬ��״̬
	public static int US_PLAY = 0x02; // ��Ϸ״̬

	public static int US_FREE = 0x10; // վ��״̬
	public static int US_SIT = 0x11; // ����״̬
	public static int US_LOOKON = 0x12; // �Թ�״̬
	public static int US_OFFLINE = 0x13;

	public static int GAME_KIND = 13;
	public static int time(Object object) {
		return (int)System.currentTimeMillis();
	}
	public static int CountArray(int by[]) {
		return by.length;
	}


	public static int countof(int[] by,int by2) {
		int cntCount = 0;
		for (int i = 0; i < by.length; i++) {
			if (by[i] == by2) {
				cntCount++;
			}
		}
		return cntCount;
	}
	public static int countof(int[] by,int by2,int count) {
		int cntCount = 0;
		for (int i = 0; i < count; i++) {
			if (by[i] == by2) {
				cntCount++;
			}
		}
		return cntCount;
	}	
	public static int replace(int[] by,int by1,int by2) {
		int cntCount = 0;
		for (int i = 0; i < by.length; i++) {
			if (by[i] == by1) {
				by[i] = by2;
				cntCount++;
			}
		}
		return cntCount;
	}
	public static int replace(int[] by,int by1,int by2,int count) {
		int cntCount = 0;		
		if(count > 0)
		{
			for (int i = 0; i < by.length; i++) {
				if (by[i] == by1) {
					by[i] = by2;
					cntCount++;
					count--;
					if(count<= 0)
					{
						break;
					}
				}
			}
		}

		return cntCount;
	}	
	public static void CopyMemory(int[] by, int by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2;
		}
	}

	public static void CopyMemory(int[] by, int[] by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2[i];
		}
	}

	public static void memcpy(int[] by, int[] by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2[i];
		}
	}
	public static int memcmp(int[] by, int[] by2, int length) {
		for (int i = 0; i < length; i++) {
			if(by[i] != by2[i])
			{
				return -1;
			}
		}
		return 0;
	}
	public static void memset(int[] by, int by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = by2;
		}
	}

	public static Random rd = new Random();
	public static int bai = 33;

	public static int rand() {
		return rd.nextInt(  1024 );
	}

	public static int rand(int i, int j, int factor) {
		return rd.nextInt(j - i) + i;
	}

	public static int sizeof(long[] m_LookOnUserID) {
		return m_LookOnUserID.length;
	}

	public static void memset(long[] by, int by2, int length) {
		for (int i = 0; i < length; i++) {
			by[i] = (long) by2;
		}

	}

	public static int sizeof(SSeatInfo[] m_seatInfo) {
		return m_seatInfo.length;
	}

	public static void memset(SSeatInfo[] m_seatInfo, int by2, int sizeof) {
		for (int i = 0; i < sizeof; i++) {
			m_seatInfo[i] = new SSeatInfo();
		}
	}

	public static void memcpy(HU hu, HU hu2) {
		hu.block = hu2.block.clone();
		hu.jiangMj = hu2.jiangMj;
	}

	public static final int BLOCK_NULL = 0; // ��
	public static final int BLOCK_CHI = 1; // ���ƽṹ
	public static final int BLOCK_SUN = 2; // ˳��ṹ
	public static final int BLOCK_PENG = 3; // ���ӽṹ,3����ͬ
	public static final int BLOCK_KE = 4; // ���ӽṹ,3����ͬ,����
	public static final int BLOCK_GANG = 5; // ���ӽṹ,4����ͬ
	public static final int BLOCK_AN_GANG = 6; // ����
	public static final int BLOCK_CHI_BAI = 7; // �װ����
	public static final int BLOCK_TIANGANG = 8;// ���
	public static final int BLOCK_TIANLong = 50;// ��
	
	public static final int ZHUANG_JIA = 0;

	public static final int PI_HU = 0;
	

	public static final int TUI_DAO_HU = 0;
	public static final int PING_HU = 4;//ƽ�� 1��2�� ������
	public static final int QUAN_QIU_REN = 5; //ȫ���� 1�� 2��
	public static final int PENG_PENG_HU = 6;//������ 2�� 4��
	public static final int GANG_KAI = 7;//���Ͽ��� 1�� 2��
	public static final int QI_DUI_ZI = 8;//�߶��� 2�� 4��
	public static final int QING_QI_DUI_ZI = 9;//���߶��� 4�� 16��
	public static final int QI_DUI_ZI_BAO_TOU = 10;//�߶��ӱ�ͷ 8��64��
	
	public static final int QING_YI_SE = 15;//��һɫ �в��� 2�� 4��
	public static final int CHUN_QING_YI_SE = 16;//��һɫ �޲��� 4�� 16��
	public static final int HUN_YI_SE = 17;//��һɫ 2�� 4��
	public static final int BAO_TOU = 18; //��ͷ�����죩 2�� 4��
	public static final int CAI_SHEN_TOU = 19;//����ͷ 4�� 16��
	
	public static final int HAI_DI_LAO_YUE = 26;//�������� 2������

	public static final int TIAN_HU = 30;//��� 2�� 4��
	public static final int DI_HU = 31;//�غ� 2�� 4��
	public static final int REN_HU = 32;//�˺� 2�� 4��
	public static final int GANG_BAO = 33;//�ܱ� 4�� 16��
	public static final int QING_FENG = 35;//��� 4�� 16��
	public static final int LUAN_FENG = 36;//�ҷ� 4��16��
	public static final int SHI_SAN_BU_KAO = 37;//ʮ������ 1��2��
	public static final int QI_FENG_BU_KAO = 38;//ʮ������ �߷� 2��4��
	public static final int SAN_CAI_YI_KE = 40;//����һ�� 4��16��
	
	public static Object sizeof(HU hu) {
		return null;
	}

	public static void memcpy(HU hu, HU hu2, Object sizeof) {
		memcpy(hu, hu2);
	}

	public static int sizeof(int[] byParam) {
		return byParam.length;
	}


	static final int ACTION_WITH_ROBOT = 100;

	static final int ACTION_GIVE_UP = 0;
	static final int ACTION_FA_PAI = 1;
	static final int ACTION_MO_PAI = 2;
	static final int ACTION_CHU_PAI = 3;
	static final int ACTION_CHI = 4;
	static final int ACTION_PENG = 5;
	static final int ACTION_GANG = 6;
	static final int ACTION_TING = 7; // ���ƣ�������Ȩ�ޣ���������ֱһ��
	static final int ACTION_HU = 8;
	static final int ACTION_HUANPAI = 10;
	static final int ACTION_GANG_BUPAI = 11;
	static final int ACTION_BU_HUA = 12;
	static final int ACTION_QIAOXIANG = 13;
	static final int ACTION_Long = 16;
	static final int ACTION_FIRST_BUHUA = 17;
	
	public static void Sort(int byHandCard[]) {
		for (int i = 0; i < byHandCard.length - 1; i++) {
			for (int j = i; j < byHandCard.length; j++) {
				int x = byHandCard[i];
				int y = byHandCard[j];
				if (x > y) {
					int tempvalue = byHandCard[i];
					byHandCard[i] = byHandCard[j];
					byHandCard[j] = tempvalue;
				}
			}
		}
	}

	public static final int[] FENGS= new int[]{27,	28,	29,	30};
}
